package com.kuqi.dao.impl;

import com.kuqi.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author:kuqi
 * @createTime:2021/10/18 19:59
 * @description:
 */

public class AccountDaoImpl implements AccountDao {

    private JdbcTemplate jdbcTemplate;

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public void outMan(String outMan, int money) {
        jdbcTemplate.update("update account set money=money-? where name=? ",money,outMan);
    }

    @Override
    public void inMan(String inMan, int money) {
        jdbcTemplate.update("update account set money=money+? where name=? ",money,inMan);
    }
}
